<template>
  <div id="newsDetail">
    <Header :showheaderLeft="false" :showBack="true" :isTitle="true"></Header>
    <div class="rootMain">
      <div class="newsTitle">
        <div class="title">{{newsInfo.noticeName}}</div>
        <p>
          <span>{{newsInfo.noticeAuthor}}</span>
          <span class="time">{{newsInfo.releaseTime}}</span>
        </p>
      </div>
      <div class="newsCon" v-html="newsInfo.noticeDetail"></div>
    </div>
  </div>
</template>
<script>
import Services from "@/service/index.js";
import Header from "@/components/header";
import { mapMutations } from "vuex";
import { Toast } from "vant";
export default {
  data() {
    return {
      id: "",
      newsInfo: ""
    };
  },
  created() {
    this.changeTitle(this.$t("m.news"));
    this.id = this.$route.query.id;
    Services.wdyNoticeEdit({
      id: this.id,
      lang: localStorage.getItem("language")
    }).then(res => {
      if (res.code == "0000") {
        this.newsInfo = res.wdyNotice;
      } else {
        Toast(res.msg);
      }
    });
  },
  components: {
    Header
  },
  computed: {},
  methods: {
    ...mapMutations(["changeTitle"])
  }
};
</script>
<style lang="scss" scoped type="text/scss">
#newsDetail {
  height: 100%;
  .rootMain {
    height: calc(100% - 0.88rem);
    top: 0.88rem;
    overflow-y: auto;
    > div {
      padding: 0.5rem 0.3rem;
    }
    .newsTitle {
      .title {
        margin-bottom: 0.2rem;
        font-size: 0.28rem;
        letter-spacing: 0.04rem;
        font-weight: bold;
      }
      p {
        span {
          font-size: 0.22rem;
          color: #aaa;
        }
      }
    }
    .newsCon {
      font-size: 0.24rem;
      color: #333;
      text-align: justify;
      line-height: 1.5;
      img {
        max-width: 100%;
      }
    }
  }
}
</style>